<%@ taglib prefix="c" uri="http://java.sun.com/jsp/jstl/core"
%><%@ taglib prefix="fmt" uri="http://java.sun.com/jsp/jstl/fmt"
%><%@ taglib prefix="security" uri="http://www.springframework.org/security/tags"
%><%@ taglib prefix="form" uri="http://www.springframework.org/tags/form"
%><%@ page language="java" contentType="text/html; charset=UTF-8" pageEncoding="UTF-8"
%>
<head>
    <title><fmt:message key="contentletContainer" /></title>
</head>
<body>
    <h1><fmt:message key="contentletContainer" /></h1>
    <div class="buttons">
       <c:url var="createUrl" value="/domain/contentletContainer/createForm.action" />
       <a href="${createUrl}"><span><fmt:message key="label.link.create" /></span></a>
    </div>

    <h2><fmt:message key="label.search.byPattern" /></h2>
    <c:url var="searchUrl" value="/domain/contentletContainer/search.action" />
    <form:form action="${searchUrl}" modelAttribute="contentletContainerSearchForm">
        <table>
            <tbody>
                <tr>
                    <th><fmt:message key="label.search.searchPattern" /></th>
                    <td>
                        <form:input path="searchParameters.searchPattern" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "searchParameters.searchPattern",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="label.search.caseSensitive" /></th>
                    <td>
                        <form:checkbox path="searchParameters.caseSensitive" /> <!-- TODO: find out why the '1' is required... can we fix this ? -->
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "searchParameters.caseSensitive1",
                                widgetType : "dijit.form.CheckBox"
                            }));
                        </script>
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="label.search.searchMode" /></th>
                    <td>
                        <form:select path="searchParameters.searchMode" items="${contentletContainerSearchForm.searchParameters.searchModeList}" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "searchParameters.searchMode",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required: "false"
                            }}));
                        </script>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                   <td colspan="2">
                        <div class="buttons">
                            <button id="searchButtonEx" type="submit"><fmt:message key="label.search.submit" /></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'searchButtonEx',
                                    event:'onclick'
                                }));
                            </script>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>

    <h2><fmt:message key="label.search.byExample" /></h2>
    <form:form action="${searchUrl}" modelAttribute="contentletContainerSearchForm">
        <table>
            <tbody>
                <tr>
                    <th><fmt:message key="contentletContainer_contentletId" /></th>
                    <td>
                        <form:select path="contentletContainer.contentletId" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.contentletId",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                    , regExp : "[-+]?[0-9]+(\.[0-9]+)?"
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.contentletId" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_containerId" /></th>
                    <td>
                        <form:select path="contentletContainer.containerId" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.containerId",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                    , regExp : "[-+]?[0-9]+(\.[0-9]+)?"
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.containerId" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_live" /></th>
                    <td>
                        <form:select path="contentletContainer.live" >
                            <form:option value="" label="--"/>
                            <form:option value="true"/>
                            <form:option value="false"/>
                        </form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.live",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.live" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_deleted" /></th>
                    <td>
                        <form:select path="contentletContainer.deleted" >
                            <form:option value="" label="--"/>
                            <form:option value="true"/>
                            <form:option value="false"/>
                        </form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.deleted",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.deleted" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_locked" /></th>
                    <td>
                        <form:select path="contentletContainer.locked" >
                            <form:option value="" label="--"/>
                            <form:option value="true"/>
                            <form:option value="false"/>
                        </form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.locked",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.locked" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_showOnMenu" /></th>
                    <td>
                        <form:select path="contentletContainer.showOnMenu" >
                            <form:option value="" label="--"/>
                            <form:option value="true"/>
                            <form:option value="false"/>
                        </form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.showOnMenu",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.showOnMenu" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_modDate" /></th>
                    <td>
                        <form:input path="contentletContainer.modDate" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.modDate",
                                widgetType : "dijit.form.DateTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.modDate" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_modUser" /></th>
                    <td>
                        <form:input path="contentletContainer.modUser" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.modUser",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.modUser" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_createDate" /></th>
                    <td>
                        <form:input path="contentletContainer.createDate" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.createDate",
                                widgetType : "dijit.form.DateTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.createDate" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_createUser" /></th>
                    <td>
                        <form:input path="contentletContainer.createUser" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.createUser",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.createUser" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_sortOrder" /></th>
                    <td>
                        <form:input path="contentletContainer.sortOrder" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.sortOrder",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                    , regExp : "[-+]?[0-9]+(\.[0-9]+)?"
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.sortOrder" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_beginTime" /></th>
                    <td>
                        <form:input path="contentletContainer.beginTime" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.beginTime",
                                widgetType : "dijit.form.DateTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.beginTime" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="contentletContainer_endTime" /></th>
                    <td>
                        <form:input path="contentletContainer.endTime" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "contentletContainer.endTime",
                                widgetType : "dijit.form.DateTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                        <form:errors cssClass="error" path="contentletContainer.endTime" />
                    </td>
                </tr>
                <tr>
                    <th><fmt:message key="label.pageSize" /></th>
                    <td>
                        <form:select path="searchParameters.pageSize">
                            <form:option value="1" label="1" />
                            <form:option value="5" label="5" />
                            <form:option value="10" label="10" />
                            <form:option value="25" label="25" />
                        </form:select>
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "searchParameters.pageSize",
                                widgetType : "dijit.form.FilteringSelect",
                                widgetAttrs : {
                                    required: "false"
                            }}));
                        </script>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <div class="buttons">
                            <button id="searchButtonEx" type="submit"><fmt:message key="label.search.submit" /></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'searchButtonEx',
                                    event:'onclick'
                                }));
                            </script>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>

    <h2><fmt:message key="label.search.byNamedQuery" /></h2>
    <p>(ex: ContentletContainerModel.selectAll)</p>
    <form:form action="${searchUrl}" modelAttribute="contentletContainerSearchForm">
        <table>
            <tbody>
                <tr>
                    <th><fmt:message key="label.search.namedQuery" /></th>
                    <td>
                        <form:input path="searchParameters.namedQuery" />
                        <script type="text/javascript">
                            Spring.addDecoration(new Spring.ElementDecoration({
                                elementId : "searchParameters.namedQuery",
                                widgetType : "dijit.form.ValidationTextBox",
                                widgetAttrs : {
                                    required : false
                                }
                            }));
                        </script>
                    </td>
                </tr>
            </tbody>
            <tfoot>
                <tr>
                    <td colspan="2">
                        <div class="buttons">
                            <button id="searchButtonNq" type="submit"><fmt:message key="label.search.submit" /></button>
                            <script type="text/javascript">
                                Spring.addDecoration(new Spring.ValidateAllDecoration({
                                    elementId:'searchButtonNq',
                                    event:'onclick'
                                }));
                            </script>
                        </div>
                    </td>
                </tr>
            </tfoot>
        </table>
    </form:form>
</body>
